MDEV-40408 btr_page_reorganize_low() uses the buffer pool just to obt…#5401
MDEV-40408 btr_page_reorganize_low() uses the buffer pool just to obt…#5401iMineLink wants to merge 1 commit into
Conversation
|
|
There was a problem hiding this comment.
Code Review
This pull request introduces a buffer-pool-independent scratch block pool (btr_scratch_pool_t) to optimize page reorganization operations by avoiding global buffer pool mutex contention. The reviewer feedback focuses on replacing raw pthread and custom condition variable primitives with their mysql_cond_* counterparts to ensure proper Performance Schema instrumentation and consistency. Additionally, the reviewer suggests introducing a debug-only active block counter (n_active) to assert that no scratch blocks are leaked when the pool is closed.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
There was a problem hiding this comment.
Pull request overview
This PR introduces a dedicated “scratch block” pool for InnoDB page reorganization paths to avoid using the global buffer pool (and therefore avoid taking buf_pool.mutex) when a temporary block is needed during page rebuild/reorganization.
Changes:
- Add
btr_scratch_pool_tplus public init/close/get/put APIs, and switchbtr_page_reorganize_low()to use it instead ofbuf_block_alloc()/free(). - Switch
page_zip_reorganize()to use the scratch pool instead of buffer-pool allocation. - Wire scratch pool lifecycle into server startup/shutdown (and mariabackup initialization).
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| storage/innobase/srv/srv0start.cc | Close the scratch pool during InnoDB shutdown. |
| storage/innobase/srv/srv0srv.cc | Initialize the scratch pool during InnoDB boot. |
| storage/innobase/page/page0zip.cc | Use scratch blocks for compressed-page reorganization temp storage. |
| storage/innobase/include/buf0buf.h | Allow buf_page_t::set_state() to optionally skip asserting buf_pool.mutex ownership. |
| storage/innobase/include/btr0btr.h | Declare scratch pool lifecycle + get/put APIs. |
| storage/innobase/btr/btr0btr.cc | Implement scratch pool and switch page reorganization to use it. |
| extra/mariabackup/xtrabackup.cc | Initialize the scratch pool in the mariabackup startup flow. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ain a scratch block Add a pool of scratch blocks, btr_scratch_pool_t, to be used instead of the global buffer pool in the page-reorganization operations, when a scratch block is needed. Removes the needs of obtaining the buf_pool.mutex in such functions, and any delay while holding at least page X-latch that it might have caused.
…ain a scratch block
Add a pool of scratch blocks, btr_scratch_pool_t, to be used instead of the global buffer pool in the page-reorganization operations, when a scratch block is needed.
Removes the needs of obtaining the buf_pool.mutex in such functions, and any delay while holding at least page X-latch that it might have caused.